package models

import (
	"fmt"
	"math/rand"
	"time"
	"weiboxs.com/new_h_glasses/enums"
	"weiboxs.com/new_h_glasses/utils"
)

var CurLoginUserInfo BackendUser
var CurLoginUserDepId int64

type JsonResult struct {
	Code enums.JsonResultCode `json:"code"`
	Msg  string               `json:"msg"`
	Data interface{}          `json:"data"`
}

type BaseQueryParam struct {
	Sort   string `json:"sort"`
	Order  string `json:"order"`
	Offset int64  `json:"offset"`
	Limit  int    `json:"limit"`
	Page   int    `json:"page"`
}

func GetErpTypeid() map[int]string {
	return map[int]string{10: "光学镜片", 20: "隐形眼镜", 30: "光学镜架", 40: "成品镜", 41: "太阳镜", 50: "护理产品", 60: "辅料其它", 70: "药品"}
}
//var ErpTypeid = map[int]string{10: "光学镜片", 20: "隐形眼镜", 30: "光学镜架", 40: "成品镜", 41: "太阳镜", 50: "护理产品", 60: "辅料其它", 70: "药品"}
var PayMode = map[int]string{10: "现金", 20: "转帐", 30: "换货", 40: "银行存款", 50: "支付宝", 60: "微信"}
var PayMethod = map[int]string{10: "实销实结", 20: "压批结", 30: "月结", 40: "现结", 50: "铺货"}
var DeliveryMode = map[int]string{10: "采购方自提", 20: "供货方送货", 30: "三方物流"}

//创建ID
func CreatePk() string {
	return fmt.Sprintf("%s%d", utils.GetDateFormat(time.Now().Unix(), "20060102150405"), func(min, max int64) int64 {
		if min >= max || min == 0 || max == 0 {
			return max
		}
		return rand.Int63n(max-min) + min
	}(100000, 999999))
}
